package com.demo.web.modules.sca;

import com.demo.common.constant.api.base.IDEntity;
import com.demo.common.constant.api.ScaBasicVOAPIConstant;
import com.demo.common.result.ResponseInfo;
import com.demo.common.result.ResultVo;
import com.demo.service.sca.ScaBasicVOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sca/basic_vo")
public class ScaBasicVOController {
    @Autowired
    private ScaBasicVOService myService;

    @GetMapping("/test")
    public String test(){
        return "hello, you are in ScaBasicVO test!";
    }


    //项目树型列表
    @RequestMapping(value = ScaBasicVOAPIConstant.SCA_PROJECT_VO_TREE_API, method = RequestMethod.POST)
    public ResultVo getAllPageVOTree(){
        return ResponseInfo.<Object>success(myService.getAllPageVOTree());
    }

    //某个项目页面树
    @RequestMapping(value = ScaBasicVOAPIConstant.SCA_PROJECT_VO_SEARCH_TREE_API, method = RequestMethod.POST)
    public ResultVo getPageVOTreeByProjectId(@RequestBody IDEntity<Long> idt){
        return ResponseInfo.<Object>success(myService.getPageVOTreeByProjectId(idt.getId()));
    }

    //设备列表
    @RequestMapping(value = ScaBasicVOAPIConstant.SCA_DEVICE_SEARCH_LIST_API, method = RequestMethod.POST)
    public ResultVo getDeviceListByProjectId(@RequestBody IDEntity<Long> idt){
        return ResponseInfo.<Object>success(myService.getDeviceListByProjectId(idt.getId()));
    }
}
